package com.itheima.anli;

import org.junit.Test;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class Test4 {


    @Test
    public void test2() throws ClassNotFoundException {

        Class<?> aClass = Class.forName("com.itheima.anli.Demo");

        Annotation[] ann = aClass.getDeclaredAnnotations();

        for (Annotation anns: ann) {
            System.out.println(aClass.getName()+":"+anns);
        }
        System.out.println("-------------------------");
        Method[] methods = aClass.getDeclaredMethods();
        for (Method method: methods) {
            Annotation[] anns = method.getDeclaredAnnotations();
            for (Annotation annotation : anns) {
                System.out.println(method.getName()+":"+annotation);
            }
        }


    }

}
